import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Question4 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int[] num = new int[n];
        int x, y;

        for (int i = 0; i < n; i++) {
            num[i] = in.nextInt();
        }

        x = in.nextInt();
        y = in.nextInt();

        for (int i = 0; i < n - 1; i++) {
            if (num[i] == x && num[i + 1] == y) {
                System.out.println("Yes");
                return ;
            }

            if (num[i] == y && num[i + 1] == x) {
                System.out.println("Yes");
                return ;
            }
        }

        System.out.println("No");
        return ;
    }
}